using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace G4KFramework.Objects
{
    public class GObjectView : GObjectBase
    {
        //---------------------------------------------------------
        // Fields
        protected SpriteBatch _spriteBatch;
        protected Vector2 _dimention;
        protected float _scale = 1.0f;
        protected float _rotation = 0.0f;
        protected Vector2 _origin = new Vector2(0.0f, 0.0f);
        protected float _layerDepth = 0.0f;
        protected Color _color = Color.White;

        //---------------------------------------------------------
        // Properties
        public float rotation
        {
            get { return _rotation; }
            set { _rotation = value; }
        }       
        public Vector2 origin
        {
            get { return _origin; }
            set { _origin = value; }
        }        
        public float layerDepth
        {
            get { return _layerDepth; }
            set { _layerDepth = value; }
        }
        public Vector2 dimention
        {
            get { return _dimention; }
            set { _dimention = value; }
        }
        protected float scale
        {
            get { return _scale; }
            set { _scale = value; }
        }
        public Color color
        {
            get { return _color; }
            set { _color = value; }
        }

        //---------------------------------------------------------
        // Construction
        public GObjectView(SpriteBatch spriteBatch)
        {
            _spriteBatch = spriteBatch;
        }

        //---------------------------------------------------------
        // Draw Texture
        public void Draw(Texture2D texture)
        {
            if (dimention.X != 0 || dimention.Y != 0)
                _spriteBatch.Draw(texture, new Rectangle((int)_position.X, (int)_position.Y, (int)dimention.X, (int)dimention.Y), null, Color.White, _rotation, _origin, SpriteEffects.None, _layerDepth);
            else
                _spriteBatch.Draw(texture, _position, null, Color.White, _rotation, _origin, _scale, SpriteEffects.None, _layerDepth);
        }
    }
}
